// 导入请求模拟数据的方法
import mockRequest from '@/utils/mockRequest'
import type { NumericDictionary } from 'lodash';

interface RankData {
    no: number;
    name: string;
    count: string;
  }
  interface WordData {
    word: string;
    count: number;
    user: number;
  }

  // 获取排行榜数据
export interface  EchartsData {
//1": "今日销售额",
salesToday: number;
salesLastDay:number;
salesGrowthLastDay: number;
salesGrowthLastMonth:number;
// 2今日订单量
orderToday:number;
orderLastDay:number;
orderTrend:number[];
//3": "今日交易用户数"
orderUserToday:number;
returnRate:number;
orderUserTrend:number[];
orderUserTrendAxis:string[];

//4: "累计用户数",
usersTotal: number;
usersLastDay: number;
usersLastMonth: number;
userGrowthLastDay: string;//"17.70",有小数点的类型是string
userGrowthLastMonth: number;//有小数点的类型是string
// /5": "销售额与访问量
orderFullYearAxis: string[];
orderFullYear: number[];
userFullYearAxis: string[];
userFullYear: number[];
orderRank: RankData[];
userRank: RankData[];
searchWord: WordData[];

//8": "分类销售排行"
saleRank:{
    category:{
        axisX:string[];
        data1:number[]; 
    }
    goods:{
        axisX:string[];
        data1:number[];
    }
}
}
// 获取排行榜数据
export function reqEchartsData() {//请求数据
    //接收两个泛型参数。第一个泛型参数any表示请求的返回数据类型是不确定的
    //第二个泛型参数EchartsData表示响应的数据类型应为EchartsData类型。
    return mockRequest.get<any,EchartsData>("echarts")
  }